﻿LoadExt = {
    InitLoading: function () {
        var div_loading = LoadExt.$('div_loading');
        if (!div_loading) {
            div_loading = document.createElement('div');
            div_loading.setAttribute('id', 'div_loading');
            div_loading.setAttribute('class', 'div_contain');
            div_loading.style['display'] = 'none';
            document.body.appendChild(div_loading);

            var div = document.createElement('div');
            div.setAttribute('class', 'div_loading');
            div_loading.appendChild(div);
        }

        var div_bg = LoadExt.$('div_bg');
        if (!div_bg) {
            div_bg = document.createElement('div');
            div_bg.setAttribute('id', 'div_bg');
            div_bg.setAttribute('class', 'div_bg');
            div_bg.style['display'] = 'none';
            document.body.appendChild(div_bg);
        }
    },
    loading: function () {
        LoadExt.InitLoading();
        LoadExt.$('div_loading').style['display'] = '';
        LoadExt.$('div_bg').style['display'] = '';
    },
    unloading: function () {
        LoadExt.InitLoading();
        LoadExt.$('div_loading').style['display'] = 'none';
        LoadExt.$('div_bg').style['display'] = 'none';
    },
    showBack: function () {
        LoadExt.InitLoading();
        LoadExt.$('div_bg').style['display'] = '';
    },
    hideBack: function () {
        LoadExt.InitLoading();
        LoadExt.$('div_bg').style['display'] = 'none';
    },
    $: function (id) {
        return document.getElementById(id);
    }
};